﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using PLSServer;

namespace AcceptServer
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            //判断之前是否已经打开了相同的进程   
            //new   Bestzone.MIS.Report.F1BookContainer();   
            bool alreadyExist = false;
            try
            {
                System.Diagnostics.Process curP = System.Diagnostics.Process.GetCurrentProcess();
                System.Diagnostics.Process[] ps = System.Diagnostics.Process.GetProcesses();
                foreach (System.Diagnostics.Process p in ps)
                {
                    if (p.ProcessName.Equals(curP.ProcessName) && p.Id != curP.Id)
                    {
                        alreadyExist = true;
                    }
                }
            }
            catch (System.PlatformNotSupportedException ex) { ex.ToString(); }
            catch (System.InvalidOperationException ex) { ex.ToString(); }

            //如果已经存在，则放弃本进程   
            if (alreadyExist)
            {
               // MessageBox.Show("你已经运行了一个实例,不能同时运行多个实例。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
              //  return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new AcceptMainForm());
        }
    }
}
